package com.aaa.dao;


import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年11月14日19:02
 */
public interface BookShopDao {

    //根据图书编号查看图书价格
    @Select("select price from book where isbn=#{isbn}")
    public int findBookPriceByIsbn(String isbn);

    //根据编号修改库存
    @Update("update book_stock set stock=stock-1 where isbn=#{isbn}")
    public void updateBookStock(String isbn);

    //根据用户名修改余额
    @Update("update account set balance=balance-#{money} where username=#{username}")
    public  void updateAccount(@Param("username")String username,@Param("money")int money);

    //根据编号查询对应的库存
    @Select("select stock from book_stock where isbn=#{isbn}")
    public int findStockByIsbn(String isbn);

    //根据账户查询对应余额
    @Select("select balance from account where username=#{username}")
    public int findBalanceByUsername(String username);



}








